﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace URGSystems.Umbraco.uVersionClientCache
{
    /// <summary>
    /// Just display the outputtype enum as a dropdown list for use in umbraco
    /// </summary>
    public class OutputTypeDropDownList : System.Web.UI.WebControls.DropDownList, umbraco.interfaces.IMacroGuiRendering
    {
        private string _value;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            foreach (var name in Enum.GetNames(typeof(OutputType)))
            {
                ListItem li = new ListItem();
                li.Text = name;
                li.Value = name;
                if (Value == name)
                    li.Selected = true;
                this.Items.Add(name);
            }
        }

        public bool ShowCaption
        {
            get { return true; }
        }

        public string Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }
    }
}
